<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://unpkg.com/vue@2.7.14/dist/vue.min.js"></script>
    <style>
        .page>span{
            margin:3px;
            padding: 5px;
            background-color: #007bff;
            border-radius: 3px;
            min-width: 4px;
            text-align: center;
            cursor: pointer;
        }
    </style>
</head>
<body>
<div id="app">
<page size="10" total="157"></page>
</div>
<script>
    Vue.component("page",{
        data(){
            return{
                allPages:10,
                curPage:1,
            }
        },
        props:["size","total"],
        template:`
            <div class="page">
                <span>首页</span>
                <span>上一页</span>
                <span v-for="p in allPages" :style="{backgroundColor:p==curPage?'#ddd':'#eee'}"
                @click="curPage = p">{{p}}</span>
                <span>下一页</span>
                <span>尾页</span>
            </div>`,
        crateed(){
            this.allPages=parseInt(this.total/this.size);
            this.allPages+=this.total%this.size ==0?0:1
        }

    })
    var v=new Vue({
        el:"#app"
    })
</script>
</body>
</html>